<template>
  <div>
        <van-nav-bar class="app-nav-bar" title="考勤列表(缺勤、晚归)" left-arrow @click-left="onClickLeft"/>
        <!-- <el-input type="date" style="width: 200px;" placeholder="请输入内容" clearable v-model="form.date"></el-input> -->
        <van-cell>请假日期：
            <el-date-picker type="date" value-format="yyyy-MM-dd" placeholder="请选择请假日期" v-model="checkDate"></el-date-picker>
            <el-button style="margin-left: 5px;" size="mini" type="primary" icon="el-icon-search" @click="getUser">搜索</el-button>
        </van-cell>
        <el-button class="btncolor" size="mini" type="success" @click="yic">异常处理列表</el-button>
        <el-table
        :data="tableData"
        style="width: 100%">
        <el-table-column
            prop="studentNo"
            label="学号">
        </el-table-column>
        <el-table-column
            prop="className"
            label="班级">
        </el-table-column>
        <el-table-column
            prop="studentName"
            label="学生姓名">
        </el-table-column>
        <el-table-column
            prop="dorAddress"
            label="宿舍">
        </el-table-column>
        <el-table-column
            prop="accessDate"
            label="缺勤日期">
        </el-table-column>
        <el-table-column
            prop="attenceStatus"
            label="状态">
            <template slot-scope="scope">
            <span style="margin-left:10px" v-if="scope.row.attenceStatus ==='2'">缺勤</span>
            <span style="margin-left:10px" v-if="scope.row.attenceStatus ==='3'">迟到</span>
            </template>
        </el-table-column>
        <el-table-column label="操作">
            <template slot-scope="scope">
                <el-button size="mini" icon="el-icon-view" @click="ck( scope.row)"></el-button>
            </template>
        </el-table-column>
        </el-table>

  </div>
</template>

<script>
export default {
data(){
        return{
            tableData:[],
            checkDate:"",
        }
    },
    methods:{
        yic(){
            this.$router.push({name: 'AttenceExcList', params: { id:2}})
        },    
        onClickLeft(){
            this.$router.go(-1) 
        },
        ck(row){
            alert("宿管老师未处理此数据!!!")
        },
        async getUser(){
            console.log(this.checkDate);
            // var now = new Date();
            // var getTimeFromDate = function (date) {
            //     return date.toTimeString().slice(0, 8).split(":").join("");//去掉分号
            // };
            // var checkDate = getTimeFromDate(new Date(now.getTime() - 1000));//现在的时间
            const {data:res} =await this.request("app/Attence/listAbsenceStu?checkDate="+this.checkDate);
            console.log(res)
            this.tableData=res.data
        },
    },created(){
        this.getUser();
    }
}
</script>

<style>

</style>